<?php

/*
 * 2021/7/15
 * 11:42
 * User: 2650332702@qq.com
 * Api Routes
 */

use Illuminate\Support\Facades\Route;

Route::group(['prefix'=>'v1','middleware'=>'throttle:5,1'],function (){
    // 用户登录
    Route::post('phonelogin',[\App\Api\Controllers\LoginController::class,'phoneLogin']);
    // QQ登录
    Route::post('qqcallback',[\App\Api\Controllers\LoginController::class,'qqCallback']);
    // 绑定用户
    Route::post('bindphone',[\App\Api\Controllers\LoginController::class,'bindPhone']);
    // 注册
    Route::post('registered',[\App\Api\Controllers\user\MembersController::class,'registered']);
    // 密码
    Route::post('password',[\App\Api\Controllers\user\MembersController::class,'password']);
    // 手机验证码
    Route::post('phoneverify', [\App\Api\Controllers\user\MembersController::class, 'phoneVerify']);
//    Route::group(['middleware'=>'apiCheck'],function () {
        // 秒杀查询
        Route::get('sklist', [\App\Api\Controllers\SeckillController::class, 'seckillList']);
        // 实时热抢
        Route::get('hotrush', [\App\Api\Controllers\SeckillController::class, 'hotRush']);
        // 时间区间查询
        Route::post('sktime', [\App\Api\Controllers\SeckillController::class, 'skTime']);
        // 进行秒杀
        Route::post('makesecond',[\App\Api\Controllers\SeckillController::class,'makeSecond']);
        // 商品详情&评论详情
        Route::post('getdetail', [\App\Api\Controllers\SeckillController::class, 'getDetail']);
        // 拼团活动
        Route::get('group', [\App\Api\Controllers\GroupingController::class, 'havePintuan']);
        // 拼团列表API
        Route::get('grouplist', [\App\Api\Controllers\GroupingController::class, 'groupList']);
        // 拼团商品详情表
        Route::get('groupdetail', [\App\Api\Controllers\GroupingController::class, 'groupDetail']);
        // 购物车商品添加
        Route::post('addcart',[\App\Api\Controllers\ShopingCartController::class,'addCart']);
        // 商品售后
        Route::post('aftersales',[\App\Api\Controllers\ShopingCartController::class,'afterSales']);
        // 收藏接口
        Route::post('collection',[\App\Api\Controllers\ShopingCartController::class,'collection']);
        // 拼团组详情表
        Route::post('groupall', [\App\Api\Controllers\GroupingController::class, 'groupAll']);
        // 拼团分享接口
        Route::post('groupshare',[\App\Api\Controllers\GroupShareController::class,'insertGroup']);
        // 立即拼团
        Route::post('nowpintuan',[\App\Api\Controllers\GroupingController::class,'nowPintuan']);
        // 用户收货地址详情
        Route::post('useraddr',[\App\Api\Controllers\AddrController::class,'getArrdList']);
        // 用户订单列表
        Route::post('orderlist',[\App\Api\Controllers\OrderListController::class,'orderList']);
        //购物车列表
        Route::get('cartlist',[\App\Api\Controllers\CartlistController::class,'cartList']);
        //计算购物车总价
        Route::get('carttotal',[\App\Api\Controllers\CartlistController::class,'cartTotalPrice']);
        //用户评论功能的实现
        Route::post('comment',[\App\Api\Controllers\CommentController::class,'comment']);
        //获取用户评论
        Route::get('getcomment',[\App\Api\Controllers\CommentController::class,'getComment']);
        //以用户现在地址获取离店铺的距离
        Route::get('geo',[\App\Api\Controllers\RedisGeoController::class,'geoGet']);
        //24H机器人在线
        Route::get('robot',[\App\Api\Controllers\RobotController::class,'robot']);
        // 快递单号
        Route::get('logistics',[\App\Api\Controllers\OrderListController::class,'logistics']);
        //Redis订阅发布
        Route::get('pub',[\App\Api\Controllers\PubController::class,'redis_publish']);
        Route::get('sub',[\App\Api\Controllers\PubController::class,'redis_sub']);

        // 修改密码
        Route::post('savepassword', [\App\Api\Controllers\user\MembersController::class, 'savePassword']);
        // 用户信息
        Route::get('memberinfo', [\App\Api\Controllers\user\MembersController::class, 'memberInfo']);
        // 修改昵称
        Route::post('savenickname', [\App\Api\Controllers\user\MembersController::class, 'saveNickname']);
        // 文件上传
        Route::post('upfile', [\App\Api\Controllers\user\MembersController::class, 'upFile']);
        // 修改头像
        Route::post('saveavatar', [\App\Api\Controllers\user\MembersController::class, 'saveAvatar']);
        // 用户余额
        Route::get('balance',[\App\Api\Controllers\user\MembersController::class,'balance']);
        // 用户充值金额
        Route::get('recharge',[\App\Api\Controllers\user\MembersController::class,'recharge']);
        // 砍价活动
        Route::get('bargainslist', [\App\Api\Controllers\activity\BargainController::class, 'BargainsList']);
        // 添加地址
        Route::post('useraddress', [\App\Api\Controllers\ShippingAddressController::class, 'addAddress']);
        // 用户砍价商品
        Route::get('userbargoods', [\App\Api\Controllers\activity\BargainController::class, 'userBargainList']);
        // 微信
        Route::get('wxpay',[\App\Api\Controllers\Pay\Wxcpay::class,'wxPay']);
        // 支付宝
        Route::get('alipay',[\App\Api\Controllers\Pay\Alicpay::class,'aliPay']);
        // 用户绑定
        Route::post('bindPhone', [\App\Api\Controllers\LoginController::class, 'bindPhone']);
        // 砍价
        Route::post('firstbar', [\App\Api\Controllers\activity\BargainController::class, 'firstBar']);
        // 砍价详情
        Route::get('bargain_goods_info', [\App\Api\Controllers\activity\BargainController::class, 'bargainGoodsInfo']);
        // 默认地址
        Route::get('address', [\App\Api\Controllers\ShippingAddressController::class, 'defaultAddress']);
        // 帮砍
        Route::post('helpbar', [\App\Api\Controllers\activity\BargainController::class, 'helpBar']);
        // 用户收货地址列表
        Route::get('useraddresslist', [\App\Api\Controllers\ShippingAddressController::class, 'addressLists']);
        // 用户收货地址详情
        Route::get('addressinfo', [\App\Api\Controllers\ShippingAddressController::class, 'addressInfo']);
        // 收货地址修改
        Route::post('saveaddress', [\App\Api\Controllers\ShippingAddressController::class, 'saveAddress']);
        // 收货地址删除
        Route::get('deladdress', [\App\Api\Controllers\ShippingAddressController::class, 'delAddress']);

        // 添加人脸
        Route::post('saveface', [\App\Api\Controllers\ApiFaceController::class, 'saveFace']);
        // 更新人脸
        Route::post('updateface', [\App\Api\Controllers\ApiFaceController::class, 'updateFace']);
        // 人脸登录
        Route::post('facelogin', [\App\Api\Controllers\LoginController::class, 'faceLogin']);
        // 帮砍列表
        Route::post('barrecord', [\App\Api\Controllers\activity\BargainController::class, 'barRecord']);
        // 创建砍价订单
        Route::post('barorder', [\App\Api\Controllers\activity\BargainController::class, 'barOrder']);
        // 查询订单表支付
        Route::get('orederlist', [\App\Api\Controllers\Pay\IsNotPay::class, 'orderList']);
        // 选用那个支付方式
        Route::post('typepay', [\App\Api\Controllers\Pay\IsNotPay::class, 'typePay']);
        //支付宝异步回调
         Route::get('alipaynotifyurl', [\App\Api\Controllers\Pay\Alicpay::class, 'aliPayNotifyUrl']);
         //支付宝退款
        Route::post('checkrefund', [\App\Api\Controllers\Pay\IsNotPay::class, 'checkRefund']);
        //支付宝查询账单
        Route::get('ordinaryPayment', [\App\Api\Controllers\Pay\IsNotPay::class, 'ordinaryPayment']);

        // 首页爆款选项卡接口
        Route::post('get_tab_card', [\App\Api\Controllers\HomepageController::class, 'getTabCard']);
        // 首页爆款选项获取商品接口
        Route::post('get_card_data', [\App\Api\Controllers\HomepageController::class, 'getCardData']);
        // 首页头部轮播图接口
        Route::post('album', [\App\Api\Controllers\HomepageController::class, 'getAlbumsFile']);
        // 首页顶部选项卡接口
        Route::post('get_head_tab', [\App\Api\Controllers\HomepageController::class, 'getHeadTab']);
        // 首页头部选项卡内容接口
        Route::post('get_tab_list', [\App\Api\Controllers\HomepageController::class, 'getTabList']);
        // 页脚接口展示
        Route::post('get_footer_list', [\App\Api\Controllers\HomepageController::class,'getFooterList']);
        // 优惠商品选项卡数据信息
        Route::post('get_rank_list', [\App\Api\Controllers\HomepageController::class, 'getRankingList']);
        // 推荐商品接口
        Route::post('get_recommend_list', [\App\Api\Controllers\PopularController::class, 'getRecommendList']);
        //商品销量排行榜接口
        Route::post('get_sales_ranking', [\App\Api\Controllers\SalesVolumeController::class, 'getSalesRanking']);
        //商品昨日销量排行榜接口
        Route::post('get_yesterday_sale', [\App\Api\Controllers\SalesVolumeController::class, 'getYesterdaySale']);

        //分类页面展示
        Route::post('get_category_page', [\App\Api\Controllers\CategorypageController::class, 'getCategoryPage']);
        //分类下商品展示
        Route::post('get_page_value', [\App\Api\Controllers\CategorypageController::class, 'getPageValue']);
        //分类查询索引创建
        Route::post('create_index',[\App\Api\Controllers\CategoryEsController::class,'createIndex']);
        //分类数据存储
        Route::post('save',[\App\Api\Controllers\CategoryEsController::class,'save']);
        //搜索数据
        Route::get('search',[\App\Api\Controllers\CategoryEsController::class,'search']);

        //添加用户订阅邮箱
        Route::post('get_email',[\App\Api\Controllers\SubscribelController::class,'getEmail']);
        //给用户发送邮箱
        Route::get('send_email',function (){
            $catch = rand(0001,9999);

            $content = "【直播电商】,您的验证码是$catch,30分钟内有效";

            \Illuminate\Support\Facades\Mail::raw($content,function (\Illuminate\Mail\Message $msg)use($catch){
                $msg->to($_GET['email']);

                $msg->subject('电商直播');

                Illuminate\Support\Facades\Redis::set($_GET['email'],$catch,1800);
            });
        });
        //邮箱验证码验证
        Route::post('get_email_catch',[\App\Api\Controllers\SubscribelController::class,'getEmailCatch']);

        //售后接口
        Route::post('get_after_data', [\App\Api\Controllers\CmcAfterSalesController::class, 'getAfterData']);
        //售后提交接口
        Route::post('after_tales_page', [\App\Api\Controllers\CmcAfterSalesController::class, 'afterTalesPage']);
        //售后成功页面信息接口
        Route::post('get_goods_site', [\App\Api\Controllers\CmcAfterSalesController::class, 'getGoodsSite']);
        //快递订单号添加接口
        Route::post('add_courier_number',[\App\Api\Controllers\CmcAfterSalesController::class,'addCourierNumber']);
        //撤销售后接口
        Route::post('del_site_revoke', [\App\APi\Controllers\CmcAfterSalesController::class, 'delSiteRevoke']);

        //用户签到接口
        Route::post('get_sign_in', [\App\Api\Controllers\CmcSignInController::class, 'getSignIn']);
        //用户消费记录
        Route::post('consumption',[\App\Api\Controllers\user\MembersController::class,'consumption']);
        //用户余额
        Route::get('balance',[\App\Api\Controllers\user\MembersController::class,'balance']);
        //用户充值金额
        Route::get('recharge',[\App\Api\Controllers\user\MembersController::class,'recharge']);
        //银行卡查询接口
        Route::post('bank_card',[\App\Api\Controllers\CmcBankCardController::class,'bankCard']);
        //银行卡绑定页面接口
        Route::post('bind_bank_card',[\App\Api\Controllers\CmcBankCardController::class,'bindBankCard']);
        //银行卡绑定手机验证码接口
        Route::post('message_pin',[\App\Api\Controllers\CmcBankCardController::class,'messagePin']);
        //银行卡添加
        Route::post('ins_bank_card',[\App\Api\Controllers\CmcBankCardController::class,'insBankCard']);
        
        // 查询直播列表所有数据，根据时间倒序排列
        Route::post('getliveList', [\App\Api\Controllers\LiveController::class,'getLiveList']);
        // 查询单个主播的信息
        Route::post('getanchor', [\App\Api\Controllers\LiveController::class,'getAnchor']);
        // 将弹幕存到redis中
        Route::post('barrage',[\App\Api\Controllers\LiveController::class,'barrage']);
        // 查询主播的回放地址
        Route::post('playback',[\App\Api\Controllers\LiveController::class,'playBackAddress']);
        // 查询单条回放地址
        Route::post('playbackonce',[\App\Api\Controllers\LiveController::class,'playBackOnce']);
        // 关闭直播
        Route::post('liveover',[\App\Api\Controllers\LiveController::class,'LiveOver']);

        // 优惠券查询接口
        Route::post('couponlist',[\App\Api\Controllers\CouponController::class,'getUserCoupon']);
        // 根据商品ID查询该商品所有的优惠券
        Route::post('goodscoupon',[\App\Api\Controllers\CouponController::class,'getListGoodsCoupon']);
        //积分
        Route::get('point',[\App\Api\Controllers\user\CmcPointLog::class,'point']);
        //积分提现
        Route::post('point_money',[\App\Api\Controllers\user\CmcPointLog::class,'pointMoney']);
//    });
});